#include <stdio.h>
#include <string.h>
#define N 256

int main()
{
	char c[N] = {0};
	scanf("%s", c);
	int offset, i, len = strlen(c);
	scanf("%d", &offset);
	if (offset < 1 || offset > 25)
		return 0;

	for (i = 0; i < len; i++)
	{
		if (c[i] >= 'A' && c[i] <= 'Z')
			c[i] = 'A' + (c[i] - 'A' + offset) % 26;
		else if (c[i] >= 'a' && c[i] <= 'z')
			c[i] = 'a' + (c[i] - 'a' + offset) % 26;
		else
			;
	}

	printf("Encrypted: %s\n", c);

	for (i = 0; i < len; i++)
	{
		if (c[i] >= 'A' && c[i] <= 'Z')
			c[i] = (c[i] - offset < 'A' ? (c[i] - offset) + 26 : c[i] - offset);
		else if (c[i] >= 'a' && c[i] <= 'z')
			c[i] = (c[i] - offset < 'a' ? (c[i] - offset) + 26 : c[i] - offset);
		else
			;
	}

	printf("Decrypted: %s\n", c);

	return 0;
}